package com.security2.demo.utils;

import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Component;

/**
 * @ClassName MyPasswordEcode
 * @Description 自定义加密方法，匹配方法
 * @Author Liujt
 * @Date 2020/1/14 14:21
 **/
@Component
public class MyPasswordEncoder implements PasswordEncoder {
    /**
     * 加密
     * @param charSequence
     * @return
     */
    @Override
    public String encode(CharSequence charSequence) {
        return "123456";
    }

    /**
     * 匹配
     * @param charSequence
     * @param s
     * @return
     */
    @Override
    public boolean matches(CharSequence charSequence, String s) {
        return charSequence.toString().equals(s);
    }
}
